<?php
	$template->_template_read("./Applications/monalisa/Templates/overview.html");
	
	$template->_template_assign("CAPTION_MLOV1", (string)$language->common->value_32);
	$template->_template_assign("CAPTION_MLOV2", (string)$language->common->value_7);
	$template->_template_assign("CAPTION_MLOV3", (string)$language->common->value_33);
	$template->_template_assign("CAPTION_MLOV4", (string)$language->common->value_34);
	$template->_template_assign("CAPTION_MLOV5", (string)$language->common->value_11);
	
	$entrys = array();
	$handle = opendir("./Applications/monalisa/Expositions/");
	$bg_color = 1;
	while ($file = readdir ($handle)) {
		if($file != "." AND $file != ".." AND substr($file, -5) == ".expo"){
			if ($bg_color == 1){
				$entrys["BG_COLOR"] = "#dedede";
				$bg_color++;
			} else {
				$entrys["BG_COLOR"] = "#efefef";
				$bg_color = 1;
			}
			$compl = "./Applications/monalisa/Expositions/".$file;
			$expo = sqlite_open($compl);
			$desc = sqlite_array_query($expo, "SELECT * FROM expo WHERE (type='desc') LIMIT 1", SQLITE_ASSOC);
			$exhibits = sqlite_array_query($expo, "SELECT * FROM expo WHERE (type='file' OR type='folder')", SQLITE_ASSOC);
			$date = sqlite_array_query($expo, "SELECT * FROM expo WHERE (type='date') LIMIT 1", SQLITE_ASSOC);
			$tinyURL = sqlite_array_query($expo, "SELECT * FROM expo WHERE (type='tiny') LIMIT 1", SQLITE_ASSOC);		
			$entrys["COMPL"] = $compl;
			$entrys["BEZEICHNUNG"] = $desc[0]['exhibit'];
			$entrys["ERSTELLUNGSDATUM"] = date("d.m.y H:i", $date[0]['exhibit']);
			$entrys["FREIGABEN"] = count($exhibits);
			if ($tinyURL != false){
				$entrys["TINYURL"] = $tinyURL[0]['exhibit'];
			}
			$template->_template_append("ENTRYS", $entrys);
			sqlite_close($expo);
		}
	}
	closedir($handle);
?>